﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using Kokomo.PeInspector.Reflection.Disassembly;

namespace Kokomo.PeInspector.Reflection
{
	/// <summary>
	/// Used to pass arguments to events regarding the method body.
	/// </summary>
	public class MethodBodyEventArgs : EventArgs
	{
		/// <summary>
		/// Gets the method.
		/// </summary>
		public MethodBase Method { get; private set; }
		/// <summary>
		/// Gets the body of the method.
		/// </summary>
		public MethodBody MethodBody { get; private set; }
		/// <summary>
		/// Gets the disassembly of the method.
		/// </summary>
		public MethodDecompilation Disassembly { get; private set; }

		/// <summary>
		/// Initializes a new instance of <see cref="MethodBodyEventArgs"/>.
		/// </summary>
		/// <param name="method">The method.</param>
		/// <param name="methodBody">The body of the method.</param>
		/// <param name="disassembly">The disassembly of the method.</param>
		/// <exception cref="ArgumentNullException"><paramref name="method"/> is <c>null</c>.</exception>
		/// <exception cref="ArgumentNullException"><paramref name="methodBody"/> is <c>null</c>.</exception>
		/// <exception cref="ArgumentNullException"><paramref name="disassembly"/> is <c>null</c>.</exception>
		public MethodBodyEventArgs(
			MethodBase method,
			MethodBody methodBody,
			MethodDecompilation disassembly
			)
		{
			if (method == null) throw new ArgumentNullException("method");
			if (methodBody == null) throw new ArgumentNullException("methodBody");
			if (disassembly == null) throw new ArgumentNullException("disassembly");

			this.Method = method;
			this.MethodBody = methodBody;
			this.Disassembly = disassembly;
		}
	}
}
